<!DOCTYPE html>
<html>
<head>
<#include "/admin/common/common.ftl" parse=true encoding="utf-8">
</head>
<body class="hold-transition skin-blue sidebar-mini">
	<div class="wrapper">
		<#include "/admin/common/header.ftl" parse=true encoding="utf-8">

		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>会员管理</h1>
				<ol class="breadcrumb">
					<li class="active">会员列表</li>
				</ol>
			</section>

			<!-- Main content -->
			<section class="content">
				<!-- Info boxes -->
				<div class="row">
					<div class="box">
						<div class="box-header">
							<div class="table-btn">
								</a> <a href="javascript:search();"> <span class="label label-primary">搜索</span>
								</a>
							</div>
						</div>
						<!-- /.box-header -->
						<div class="box-body">
							<table id="defaultForm" class="table table-striped">
								<thead>
									<tr>
										<th>会员用户名</th>
										<th>会员邮箱</th>
										<th>激活状态</th>
										<th>最新登录时间</th>
										<th>登录总次数</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<#if list??&&(list?size>0)> <#list list as entity>
									<tr>
										<td>${entity.username!}</td>
										<td>${entity.email!}</td>
										<td>${entity.isActivated!}</td>
										<td>${entity.lastestLoginTime}</td>
										<td>${entity.totalLoginNum!}</td>
										<td>
											<a href="javascript:preview('${entity.id!}')"> <span class="label label-primary">查看详情</span></a>
											<#if entity.isAllowLogin == "是"><a href="javascript:shiftIn('${entity.id!}')"> <span class="label label-primary">移入黑名单</span></a>
											<#else>
												<a href="javascript:shiftOut('${entity.id!}')"> <span class="label label-primary">移出黑名单</span></a>
											</#if>
											
											<a href="javascript:del('${entity.sn!}')"> <span class="label label-primary">删除</span></a>  
										</td>
									</tr>
									</#list> <#else>
									<tr>
										<td colspan="20">暂无记录</td>
									</tr>
									</#if>
									<!-- /.box-body -->

								</tbody>
							</table>
						</div>
						<!-- /.box-body -->

					</div>
					<#include "/admin/common/pager-auto-reload.ftl" parse=true encoding="utf-8">
				</div>
				<!-- /.row -->
			</section>
			<!-- /.content -->
		</div>
		<!-- /.content-wrapper -->
	</div>
	<!-- ./wrapper -->
	<#include "/admin/common/footer.ftl" parse=true encoding="utf-8">
</body>

	<script type="text/javascript">
        function del(sn){
	        bootbox.setLocale("zh_CN");
	        bootbox.confirm("您确认删除选定的记录吗？", function(result){
		        if(result){
			        var url = "${base}/admin/member/personal/delete/" + sn + ".do";
			        var entity = {
				        sn : sn
			        };
			        var onloadFunc = function(result){
				        if(result.isSuccess == true){
				        	bootbox.alert(result.message);
					        history.go(0);
				        }else{
				        	bootbox.alert(result.message);
				        }
			        };
			        httpRequestPostJson(url, entity, false, onloadFunc);
		        }
	        });
        }

        function preview(memberId){
	        window.location = '${base}/admin/member/personal/' + memberId + '/preview.do';
        }
        
        function search(){
	        window.location = "${base}/admin/member/personal/search.do";
        }
        
       
		function shiftIn(memberId) {
			if (window.confirm("您确认将该用户移入黑名单吗？")) {
				var url = "${base}/admin/member/personal/shiftIn/" + memberId
						+ ".do";
				var entity = {};
				var onloadFunc = function(result) {
					if (result.isSuccess == true) {
						window.alert(result.message);
					} else {
						window.alert(result.message);
					}
					history.go(0);
				};
				httpRequestPostJson(url, entity, false, onloadFunc);
			}
		}

		function shiftOut(memberId) {

			if (window.confirm("您确认将该用户移出黑名单吗？")) {
				var url = "${base}/admin/member/personal/shiftOut/" + memberId
						+ ".do";
				var entity = {};
				var onloadFunc = function(result) {
					if (result.isSuccess == true) {
						window.alert(result.message);
					} else {
						window.alert(result.message);
					}
					history.go(0);
				};
				httpRequestPostJson(url, entity, false, onloadFunc);
			} else {
				return;
			}

		}
	</script>
</html>

